﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data {
	public partial class DistributionProductMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<DistributionProduct> {
		public DistributionProductMap() {
			// table
			ToTable("mc_DistributionProduct", "dbo");

			// keys
			HasKey(t => t.Id);

			// Properties
			Property(t => t.Id)
				.HasColumnName("Id")
				.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
				.IsRequired();
            Property(t => t.CategoryId)
                 .HasColumnName("CategoryId")
                 .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsRequired();
            Property(t => t.ProductId)
               .HasColumnName("ProductId")
               .IsRequired();

            HasRequired(t => t.Product)
              .WithMany()
              .HasForeignKey(d => d.ProductId)
              .WillCascadeOnDelete(false);

        }
	}
}
